module.exports = (vm) => {
  // 定义TOC 客户查询header
  const TOC_HEADER = { "CLIENT-TOC": "Y" };

  return {
    vxLogin: (params = {}) =>
      vm.$u.post("/auth/oauth2/token", params, {
        "CLIENT-TOC": "Y",
        "SKIP_TOKEN": "Y",
        Authorization: "Basic bWluaTptaW5p", //"mini:mini"
        "content-type": "application/x-www-form-urlencoded",
      }),

    vxLogout: (params = {}, header = {}) =>
      vm.$u.delete("/auth/token/logout", params, TOC_HEADER),

    // 个人信息
    app: {
      getUserInfo: (header = {}) =>
        vm.$u.get("/app/appuser/info", {}, TOC_HEADER),
      updateUserInfo: (params = {}, header = {}) =>
        vm.$u.put("/app/appuser/edit", params, TOC_HEADER),
    },
  };
};
